home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / comm / www / autoindex2i.lha / scale_and_crop.rex < prev    next >
OS/2 REXX Batch file  |  2000-04-12  |  1KB  |  48 lines

  1. /*************************************/
  2. /* Image Engineer Macro              */
  3. /* by Savel                          */
  4. /* Scale a given image by any        */
  5. /* size and autocrop border. (c)1997 */
  6. /*************************************/
  7. address IMAGEENGINEER
  8. Options results
  9. signal on error         /* Setup a place for errors to go */
  10. if arg()==0 then exit
  11.  
  12. PARSE ARG source dest sizex sizey
  13. /* say source
  14. say dest
  15. say sizex
  16. say sizey
  17. */
  18. 'TYPE 24bit'
  19. OPEN source
  20. Project=RESULT
  21. AUTOCROP Project
  22. Project2=RESULT
  23. Close Project
  24. SCALE Project2 sizex sizey BEST
  25. Project=RESULT
  26. Close Project2
  27. 'SAVE_DATA 'Project' 'dest' "JPEG (IJG-JFIF)"'
  28. Close Project
  29. exit
  30.  
  31. /*******************************************************************/
  32. /* This is where control goes when an error code is returned by IE */
  33. /* It puts up a message saying what happened and on which line     */
  34. /*******************************************************************/
  35. error:
  36. if RC=5 then do         /* Did the user just cancel us? */
  37.    IE_TO_FRONT
  38.    LAST_ERROR
  39.    'REQUEST "'||RESULT||'"'
  40.    exit
  41. end
  42. else do
  43.    IE_TO_FRONT
  44.    LAST_ERROR
  45.    'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  46.    exit
  47. end
  48.